home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume91 / utilitys / makemenu / part01 / MakeMenu.doc < prev    next >
Text File  |  1991-03-04  |  7KB  |  168 lines

  1.         MakeMenu V1.0 (15-oct-90) - by Hans Jansen
  2.  
  3.  
  4.   This package aims to facilitate the design and coding of Intuition Menu
  5.   structures.  It consists of two programs, the actual MakeMenu program, which
  6.   creates a C code file from a simple menu description file, and a TestMenu
  7.   program, which, when linked with the compiled output of MakeMenu, enables
  8.   you to view the menu without having to build a complete application around
  9.   it.
  10.   
  11. MakeMenu:
  12.   
  13.   This program was adapted from "Menu Builder V1.0" by Custom Services, as
  14.   published on Fish Disk #65.
  15.   The original program contains the following copyright statement:
  16.  
  17.  ___________________________________________________________________________
  18. |                                                                           |
  19. |      This Software is Copyrighted 1986 by Custom Services                 |
  20. |      All rights to this and the generated data are the property           |
  21. |      of Custom Services and may not be used for Commercial purposes       |
  22. |      without the express written consent of Custom Services.              |
  23. |___________________________________________________________________________|
  24.   
  25.   I adapted the program to my own, somewhat extended, needs because it
  26.   originally only generated menu items with the CHECKIT attribute,
  27.   without even so much as highlighting the selected item.
  28.  
  29.  
  30.   Like its predecessor, MakeMenu takes a simple sequential file and
  31.   from that file generates the menu structures for a program.
  32.  
  33.   Call:
  34.     MakeMenu ifile ofile
  35.  
  36.   ifile :
  37.     The menu descriptor file, containing lines of the form:
  38.  
  39.     MENU,[Flags],Name
  40.     ITEM,[Flags],Name,[Select],[Command]
  41.     SUBI,[Flags],Name,[Select],[Command]
  42.  
  43.     Name is the name of the Menu, Item or SubItem.
  44.  
  45.     Select is an optional name which will display when the item is
  46.     clicked upon.
  47.   
  48.     Command is the Character to use for selection of the menu item with
  49.     the AMIGA key.  Only single letters A-Z are allowed.  The letters
  50.     M and N are not allowed since Intuition uses these for screen control.
  51.  
  52.     Flag (for menu entry):
  53.     "D" specifies the menu to be disabled.
  54.       Default attributes for a Menu's Flags field are:
  55.     MENUENABLED.
  56.  
  57.     Flags (for menu item entry):
  58.     "D" specifies the menu to be disabled.
  59.     "T" sets the item attribute MENUTOGGLE;
  60.     "C" sets the item attribute CHECKIT;
  61.     "S" sets the item attribute CHECKED ("Selected").
  62.       Default attributes for an Item's or SubItem's Flags field are:
  63.     ITEMENABLED | ITEMTEXT | HIGHCOMP.
  64.       Note that no plausibility check is done on the combination of these 
  65.       attributes!
  66.  
  67.   ofile :
  68.     The resulting C code file, compilable as is! You may, however,
  69.     edit the source to modify the options.
  70.  
  71.   Processing:
  72.  
  73.     The text file is read line by line and the data saved in the regular
  74.     Intuition structures.   After all data is read and no errors have
  75.     been found the program will output to STDOUT all the text needed to
  76.     generate the menu described.  If sub menus are specified the position
  77.     of the sub menu will be about 40 % overlapped with the linked menu item.
  78.  
  79.     The positioning of a menu will be automatically calculated based on the
  80.     length of the strings used in the menu to the left of this one.  The
  81.     widest string will be used to base the width.  Most of this processing
  82.     is contained in the function Do_Output; change its parameters as needed.
  83.  
  84.     The structs Menu, MenuItem, and IntuiText will be generated as needed
  85.     to define the menus based on the input file.
  86.  
  87.   You will need to include the statement:
  88.  
  89.     extern struct Menu *MyMenu;
  90.  
  91.   in your source program and call:
  92.  
  93.     SetMenuStrip (window_ptr, MyMenu);
  94.  
  95.   Also, before you close your window you must call:
  96.  
  97.     ClearMenuStrip (window_ptr);
  98.  
  99.   or risk a spectacular crash!
  100.  
  101. TestMenu:
  102.  
  103.   This program was adapted from the Intuition/Menus example in pages
  104.   125-133 of the V1.3 RKM "Libraries and Devices:, also published on
  105.   Fish Disk #344 (the "Libs&DevsCompanion").  On that disk, the program
  106.   carried the following copyright statement:
  107.     
  108. /* Copyright (c) 1990 Commodore-Amiga, Inc.
  109.  *
  110.  * This example is provided in electronic form by Commodore-Amiga, Inc. for
  111.  * use with the 1.3 revisions of the Addison-Wesley Amiga reference manuals. 
  112.  * The 1.3 Addison-Wesley Amiga Reference Manual series contains additional
  113.  * information on the correct usage of the techniques and operating system
  114.  * functions presented in this example.  The source and executable code of
  115.  * this example may only be distributed in free electronic form, via bulletin
  116.  * board or as part of a fully non-commercial and freely redistributable
  117.  * diskette.  Both the source and executable code (including comments) must
  118.  * be included, without modification, in any copy.  This example may not be
  119.  * published in printed form or distributed with any commercial product.
  120.  * However, the programming techniques and support routines set forth in
  121.  * this example may be used in the development of original executable
  122.  * software products for Commodore Amiga computers.
  123.  * All other rights reserved.
  124.  * This example is provided "as-is" and is subject to change; no warranties
  125.  * are made.  All use is at your own risk.  No liability or responsibility
  126.  * is assumed.
  127.  */
  128.  
  129.   This program, when linked with the (compiled) output from MakeMenu,
  130.   will enable you to fast-prototype your menu design.  The program will
  131.   report the menu/item/subitem numbers for any selection you make.
  132.  
  133. Usage of the package:
  134.  
  135.   Build your menu description file with any text editor.  Run it through
  136.   MakeMenu by a command like
  137.     MakeMenu menu.test menu.c
  138.   Then compile the resulting .c file and link the object with your own
  139.   application.  That is all there is to it!
  140.  
  141.   The supplied makefile (for PDC V3.3) will automatically build a new
  142.   executable for the test program TestMenu, when you define a new menu in
  143.   the file Menu.Test; the resulting output file will be called Menu.c.
  144.   When all goes well, it will also run the TestMenu program to let you
  145.   view your menu.
  146.  
  147. Bugs:
  148.  
  149.   You must be kidding! I don't write any bugs into my software! [(:-)]
  150.   However, should you find anything wrong with the program, I should be
  151.   pleased to hear about it.  Please e-mail me to the address below.
  152.  
  153.   Notice that currently there is no way to generate mutual-exclusion
  154.   flags.  Should I ever appear to need that functionality, I will probably
  155.   add it and repost the package.  I have no way to predict when that will
  156.   be, if ever.
  157.   You are free to do with the package as you like; but in case of any
  158.   extensions being added I should still like to have a copy.
  159.  
  160.   This package has been developed using PDC V3.33.  I have not tried to
  161.   produce a makefile compatible to Aztec or SAS C; but I do not believe
  162.   adaptation to those environments will give any problems.
  163.  
  164. --
  165. J (Hans) W Jansen @ Philips Medical Systems Nederland, Dept. DA&S-EDM
  166. Building QP-1115    PO Box 10000    5680 DA Best      The Netherlands
  167. UUCP: hj@philtis.cft.philips.nl                 Voice: +31 040 763342
  168.